const base = 'cbv.aux.member';

/**
 * 查询用户列表
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function search({ pg, search }) {
  return RSocket.rs({
    route: `${base}.search`,
    args: {
      pg: { ...pg },
      search: {
        ...search,
      },
    },
  });
}

/**
 * 查询用户数量
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function count({ search }) {
  return RSocket.rr({
    route: `${base}.search.count`,
    args: {
      search: {
        ...search,
      },
    },
  });
}

/**
 * 查询指定用户
 * @param {*} param0
 * @returns
 */
export function get(id) {
  return RSocket.rr({
    route: `${base}.${id}.search`,
  });
}

/**
 * 添加用户
 * @param {*} param0
 * @returns
 */
export function create(data) {
  return RSocket.rr({
    route: `${base}.create`,
    data: {
      ...data,
    },
  });
}

/**
 * 编辑用户
 * @param {*} param0
 * @returns
 */
export function update(data) {
  return RSocket.rr({
    route: `${base}.update`,
    data: {
      ...data,
    },
  });
}

/**
 * 删除用户
 * @param {*} param0
 * @returns
 */
export function remove(id) {
  return RSocket.rr({
    route: `${base}.${id}.delete`,
  });
}

/**
 * @description 获取司机群组
 * @param {*} search 参数
 * @returns array
 */
// eslint-disable-next-line no-shadow
export function getGroup({ search, pg }) {
  return RSocket.rs({
    route: 'cbv.aux.group.search',
    args: {
      search,
      pg,
    },
  });
}

/**
 * @description 查询司机
 * @param {*} args 参数
 * @returns array
 */
export function getDriver(args) {
  return RSocket.rs({
    route: 'drivers',
    args: {
      search: { ...args },
      pg: { page: 0, size: 10 },
    },
  });
}

/**
 * 获取字典
 * @returns 字典列表
 */
export function getDicts(id) {
  return RSocket.rs({
    route: `dicts.${id}.items`,
    args: {
      search: {},
      pg: { page: 0, size: 999, sort: ['itemId;asc'] },
    },
  });
}

/**
 * 下载模版
 * @returns blob
 */
export function download() {
  return RSocket.rs({
    route: `${base}.download`,
    binary: true,
  });
}

/**
 * 上传模版文件
 * @param {*} binaryId
 * @param {*} args
 * @returns
 */
export function importing(binaryId, args) {
  return RSocket.rr({
    route: `${base}.${binaryId}.importing`,
    binary: true,
    args: {
      ...args,
    },
  });
}

/**
 * 上传文件
 * @param {*} binaryId
 * @param {*} args
 * @returns
 */
export function filesUpload(args, data) {
  return RSocket.rc({
    route: 'files.upload',
    args: {
      ...args,
    },
    data,
  });
}

/**
 * 修改接单状态
 * @param {*} binaryId
 * @param {*} args
 * @returns
 */
export function updateTakeStatus(args) {
  return RSocket.rr({
    route: 'cbv.aux.member.update.take.order.status',
    args: {
      ...args,
    },
  });
}

/**
 * 获取订单列表
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function order({ search, pg }) {
  return RSocket.rs({
    route: 'cbv.aux.order.search',
    args: {
      search,
      pg,
    },
  });
}

/**
 * 获取订单数量
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function orderCount({ search }) {
  return RSocket.rr({
    route: 'cbv.aux.order.search.count',
    args: {
      search: {
        ...search,
      },
    },
  });
}

/**
 * 查询任务列表数量
 * @param {*} param0
 * @returns
 */
// eslint-disable-next-line no-shadow
export function taskCount({ search }) {
  return RSocket.rr({
    route: 'cbv.aux.task.search.count',
    args: {
      search: {
        ...search,
      },
    },
  });
}

/**
 * @func 获取二维码
 */
export function getQRCode(args) {
  return RSocket.rs({
    route: `wx.${global.getEnvCfg().backup}.post.binary`,
    args: {
      uri: '/wxa/getwxacode',
      body: {
        ...args,
        width: 800,
      },
    },
    binary: true,
  });
}

/**
 * 通过审核
 */
export function passCheck(id) {
  return RSocket.rr({
    route: `cbv.aux.member.${id}.check`,
  });
}

/**
 * 查询车辆
 */
export function getVehicle({ search, pg }) {
  return RSocket.rs({
    route: 'cbv.aux.vehicle',
    args: {
      search,
      pg,
    },
  });
}

/**
 * 查询车辆
 */
export function getVehicleCount({ search }) {
  return RSocket.rr({
    route: 'cbv.aux.vehicle.count',
    args: {
      search,
    },
  });
}

/**
 * 查询司机
 */
export function getMemberDriver(args) {
  return RSocket.rs({
    route: 'cbv.aux.member.driver',
    args: {
      ...args,
    },
  });
}

/**
 * 日志流水分页条件查询
 * @param {}
 */
// eslint-disable-next-line no-shadow
export function getLogs({ search, pg }) {
  return RSocket.rs({
    route: 'logs',
    args: {
      search,
      pg,
    },
  });
}

/**
 * 日志流水分页条件查询数量
 * @param {}
 */
// eslint-disable-next-line no-shadow
export function getLogsCount({ search }) {
  return RSocket.rr({
    route: 'logs.count',
    args: {
      search,
    },
  });
}

/**
 * 是否可以修改车辆
 * @param {}
 */
export function updateVehicleFlag(args) {
  return RSocket.rr({
    route: 'cbv.aux.member.update.maintain.vehicle.status',
    args: {
      ...args,
    },
  });
}

/**
 * 获取成员公司列表
 * @param {}
 */
export function getCompaniesNames() {
  return RSocket.rs({
    route: 'cbv.aux.member.list.company.name',
  });
}

/**
 * 修改该手机号下所有成员公司名称
 * @param {}
 */
export function updateMemberCompanyName(args) {
  return RSocket.rr({
    route: 'cbv.aux.member.update.company.name',
    args: { ...args },
  });
}
